package co.edu.usbcali.egrapico.vista.ambient;

public class PanelTell extends javax.swing.JInternalFrame {

    private javax.swing.ImageIcon Iobjeto1, Iobjeto2, Iobjeto3;
    private javax.swing.JLabel l3;
    private String nameParent;
    LabelPrecedent l1;
    LabelProgram l2;
    private String nameLabelAsk;
    private String nameParentParent;
    private boolean consecuent = true;

    /**
     * Creates a new instance of PanelDragAndDrop
     */
    public PanelTell() {
        super();
        setClosable(true);
        Iobjeto1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/tellPreceding.gif"));
        Iobjeto2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/program2.gif"));
        Iobjeto3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/arrow.gif"));
        nameParent = "";
        l1 = new LabelPrecedent();
        l1.setIcon(Iobjeto1);
        l2 = new LabelProgram();
        l2.setIcon(Iobjeto2);
        l3 = new javax.swing.JLabel();
        l3.setIcon(Iobjeto3);
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.X_AXIS));
        setBackground(new java.awt.Color(255, 255, 255));
        setFrameIcon(null);
        getContentPane().add(l1);
        getContentPane().add(l3);
        getContentPane().add(l2);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setBounds(160, 110, 203, 110);
        setVisible(true);
        l1.addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {
                L1MouseClicked(evt);
            }
        });
        l2.addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {
                L2MouseClicked(evt);
            }
        });
    }

    public void addMyListenerToLPane() {
        l1.addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {
                L1MouseClicked(evt);
            }
        });
        l2.addMouseListener(new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {
                L2MouseClicked(evt);
            }
        });
    }

    private void L1MouseClicked(java.awt.event.MouseEvent evt) {
        if (evt.getClickCount() == 2) {
            if (l1.isCreate() == false) {
                l1.setNameParent(getNameParent());
                l1.Ladicionar();
            } else {
                l1.setNameParent(getNameParent());
                l1.mostrarPanel();
            }
        }
    }

    private void L2MouseClicked(java.awt.event.MouseEvent evt) {
        if (evt.getClickCount() == 2) {
            if (l2.isCreate() == false) {
                l2.setNameParent(getNameParent());
                l2.L1adicionar();
            } else {
                l2.setNameParent(getNameParent());
                l2.mostrar1Panel();
            }
        }
    }

    public void loadFrame(PanelTell as) {
        nameParent = as.nameParent;
        nameParentParent = as.nameParentParent;
        nameLabelAsk = as.nameLabelAsk;
        l1.setTitlePanel(as.getprecedentL().getTitlePanel());
        l1.setNameParent(as.getprecedentL().getNameParent());
        l1.getFrame().loadFrame(as.getprecedentL().getFrame());
        l1.Ladicionar();
        l2.setTextPane(as.getprogramL().getTextPane());
        l2.setTextToolTip(as.getprogramL().getTextPane());
        l2.setTitlePanel(as.getprogramL().getTitlePanel());
        l2.setNameParent(as.getprogramL().getNameParent());
        l2.L1adicionar();
    }

    public void setNameParent(String name) {
        nameParent = name;
        l1.setNameParent(nameParent);
        l2.setNameParent(nameParent);
    }

    public String getNameParent() {
        return nameParent;
    }

    public void setNameParentLabel(String name) {
        nameLabelAsk = name;
    }

    public String getNameParentLabel() {
        return nameLabelAsk;
    }

    public void setNameParentParent(String name) {
        nameParentParent = name;
    }

    public String getNameParentParent() {
        return nameParentParent;
    }

    public void setIsConsecuent(boolean b) {
        consecuent = b;
    }

    public boolean getIsConsecuent() {
        return consecuent;
    }

    public void mostrarPrecedent() {
        if (l1.isCreate() == false) {
            l1.setNameParent(getNameParent());
            l1.Ladicionar();
        } else {
            l1.setNameParent(getNameParent());
            l1.mostrarPanel();
        }
    }

    public void mostrarConsecuent() {
        if (l2.isCreate() == false) {
            l2.setNameParent(getNameParent());
            l2.L1adicionar();
        } else {
            l2.setNameParent(getNameParent());
            l2.mostrar1Panel();
        }
    }

    public LabelPrecedent getprecedentL() {
        return l1;
    }

    public LabelProgram getprogramL() {
        return l2;
    }

    public void hideConsecuent() {
        l2.getFrame().setVisible(false);
    }
}